/*
 *
 *
 */
#include "window_data.h"
#include "window_voice_combined.h"

#if GKT_CONFIG_VOICE_OUTPUT_ENABLE

#if 1
const gkt_voice_meta_id_t gc_window_voice_meta_numbers[GKT_LANGUAGE_NUMS][10] = {
#if	GKT_LANG_CHINESE_ENABLE
	{
		WINDOW_VOICE_META_ID_CN_0_0_T293,
		WINDOW_VOICE_META_ID_CN_1_1_T193,
		WINDOW_VOICE_META_ID_CN_2_2_T193,
		WINDOW_VOICE_META_ID_CN_29_3_T253,
		WINDOW_VOICE_META_ID_CN_30_4_T273,
		WINDOW_VOICE_META_ID_CN_5_5_T293,
		WINDOW_VOICE_META_ID_CN_6_6_T193,
		WINDOW_VOICE_META_ID_CN_35_7_T293,
		WINDOW_VOICE_META_ID_CN_36_8_T173,
		WINDOW_VOICE_META_ID_CN_9_9_T233
	},
#endif
#if GKT_LANG_ENGLISH_ENABLE
	{
		WINDOW_VOICE_META_ID_EN_00_zero_H493,
		WINDOW_VOICE_META_ID_EN_01_one_H353,
		WINDOW_VOICE_META_ID_EN_28_two_T333,
		WINDOW_VOICE_META_ID_EN_29_three_T293,
		WINDOW_VOICE_META_ID_EN_30_four_T293,
		WINDOW_VOICE_META_ID_EN_33_five_T393,
		WINDOW_VOICE_META_ID_EN_06_six_H513,
		WINDOW_VOICE_META_ID_EN_35_seven_T333,
		WINDOW_VOICE_META_ID_EN_08_eight_H373,
		WINDOW_VOICE_META_ID_EN_37_nine_T393
	}
#endif
};
#endif

#if defined(GKT_CONFIG_VOICE_USED_FULLY_AUTOMATIC_SOUND)	\
	&& GKT_CONFIG_VOICE_USED_FULLY_AUTOMATIC_SOUND

/* voice meta ids table variables */
#undef WINDOW_VOICE_COMBINED_ATTR

#define WINDOW_VOICE_COMBINED_ATTR(name, ...)	\
	static const gkt_voice_meta_id_t sc_window_voice_##name##_meta_ids_chinese[] = {	\
		__VA_ARGS__, \
	};
WINDOW_VOICE_COMBINED_ATTRS_CHINESE_TABLE

/* voice combined attrs table */
#undef WINDOW_VOICE_COMBINED_ATTR
#define WINDOW_VOICE_COMBINED_ATTR(name, ...)	\
	{	\
		.meta_nums	= sizeof(sc_window_voice_##name##_meta_ids_chinese) / sizeof(gkt_voice_meta_id_t),	\
		.meta_ids	= sc_window_voice_##name##_meta_ids_chinese,	\
	},

static const gkt_voice_combined_attr_s sc_window_voice_combined_attrs_chinese[] = {	\
	{ 0, NULL },
	WINDOW_VOICE_COMBINED_ATTRS_CHINESE_TABLE
};

static gkt_window_voice_config_params_s s_window_voice_config_params_chinese = {
	.combined_nums	= WINDOW_VOICE_COMBINED_ID_MAX,
	.attrs_table	= sc_window_voice_combined_attrs_chinese,

	.common_combined_ids	= {
		[GKT_WINDOW_VOICE_COMMON_OPERATION_FORBID]	= WINDOW_VOICE_COMBINED_ID(forbid),
	},

#if 1
	.index_hint_meta_ids = {
		WINDOW_VOICE_META_ID_CN_71_qingan0_T633,
		WINDOW_VOICE_META_ID_CN_27_qingan1_T573,
		WINDOW_VOICE_META_ID_CN_28_qingan2_T513,
		WINDOW_VOICE_META_ID_CN_29_qingan3_T613,
		WINDOW_VOICE_META_ID_CN_30_qingan4_T633,
		WINDOW_VOICE_META_ID_CN_33_qingan5_T633,
		WINDOW_VOICE_META_ID_CN_34_qingan6_T553,
		WINDOW_VOICE_META_ID_CN_35_qingan7_T673,
		WINDOW_VOICE_META_ID_CN_36_qingan8_T593,
		WINDOW_VOICE_META_ID_CN_37_qingan9_H633,
#if GKT_WINDOW_VOICE_REPEAT_LISTEN
		WINDOW_VOICE_META_ID_CN_71_chongting_H393,
#endif
	},
#endif

};
#endif

#if defined(GKT_CONFIG_VOICE_USED_ENGLISH_SOUND)	\
	&& GKT_CONFIG_VOICE_USED_ENGLISH_SOUND
	/* voice meta ids table variables */
#undef WINDOW_VOICE_COMBINED_ATTR
#define WINDOW_VOICE_COMBINED_ATTR(name, ...)	\
		static const gkt_voice_meta_id_t sc_window_voice_##name##_meta_ids_english[] = {	\
			__VA_ARGS__, \
		};
WINDOW_VOICE_COMBINED_ATTRS_ENGLISH_TABLE

	/* voice combined attrs table */
#undef WINDOW_VOICE_COMBINED_ATTR
#define WINDOW_VOICE_COMBINED_ATTR(name, ...)	\
		{	\
			.meta_nums	= sizeof(sc_window_voice_##name##_meta_ids_english) / sizeof(gkt_voice_meta_id_t),	\
			.meta_ids	= sc_window_voice_##name##_meta_ids_english,	\
		},
static const gkt_voice_combined_attr_s sc_window_voice_combined_attrs_english[] = {	\
	{ 0, NULL },
	WINDOW_VOICE_COMBINED_ATTRS_ENGLISH_TABLE
};

static gkt_window_voice_config_params_s s_window_voice_config_params_english = {
	.combined_nums	= WINDOW_VOICE_COMBINED_ID_MAX,
	.attrs_table	= sc_window_voice_combined_attrs_english,

	.common_combined_ids	= {
		[GKT_WINDOW_VOICE_COMMON_OPERATION_FORBID]	= WINDOW_VOICE_COMBINED_ID(forbid),
	},
#if 1
	.index_hint_meta_ids = {
		WINDOW_VOICE_META_ID_EN_71_press_0_T673,
		WINDOW_VOICE_META_ID_EN_27_press_1_T593,
		WINDOW_VOICE_META_ID_EN_28_press_2_T633,
		WINDOW_VOICE_META_ID_EN_29_press_3_T613,
		WINDOW_VOICE_META_ID_EN_30_press_4_T673,
		WINDOW_VOICE_META_ID_EN_33_press_5_T753,
		WINDOW_VOICE_META_ID_EN_34_press_6_H753,
		WINDOW_VOICE_META_ID_EN_35_press_7_T653,
		WINDOW_VOICE_META_ID_EN_36_press_8_M673,
		WINDOW_VOICE_META_ID_EN_37_press_9_T693,
#if GKT_WINDOW_VOICE_REPEAT_LISTEN
		WINDOW_VOICE_META_ID_EN_71_To_listen_again_H893,
#endif

	},
#endif

};
#endif

void window_voice_combined_init(void)
{
#if defined(GKT_CONFIG_VOICE_USED_FULLY_AUTOMATIC_SOUND)	\
	&& GKT_CONFIG_VOICE_USED_FULLY_AUTOMATIC_SOUND
	gkt_window_voice_config(GKT_LANG_CHINESE, &s_window_voice_config_params_chinese);
#endif
#if defined(GKT_CONFIG_VOICE_USED_ENGLISH_SOUND)	\
	&& GKT_CONFIG_VOICE_USED_ENGLISH_SOUND
	gkt_window_voice_config(GKT_LANG_ENGLISH, &s_window_voice_config_params_english);
#endif

#if !defined(GKT_CONFIG_WINDOW_VOICE_MUTE_DISABLE) \
	|| !GKT_CONFIG_WINDOW_VOICE_MUTE_DISABLE
	gkt_window_voice_set_mute(gp_window_data->voice_mute_enable);
#endif

	/* key voice */
	gkt_key_voice_set_id(GKT_KEY_VOICE_VALID, WINDOW_VOICE_COMBINED_ID(key));
}

#endif

